home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 860 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.0 KB  |  52 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: constness of private members and methods
  5. Date: 26 Mar 1996 16:22:59 GMT
  6. Organization: GABI Software, Sarl.
  7. Sender: news@lts.sel.alcatel.de
  8. Approved: clamage@eng.sun.com (comp.std.c++)
  9. Message-ID: <KANZE.96Mar26121837@slsvipt.lts.sel.alcatel.de>
  10. References: <4j49e0$8fo@dub-news-svc-4.compuserve.com>
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. In-Reply-To: Philippe Verdy's message of 25 Mar 1996 10:04:56 PST
  13. Apparently-To: std-c++@ncar.ucar.edu
  14. Content-Length: 967
  15. X-Lines: 27
  16. Originator: clamage@taumet
  17.  
  18. In article <4j49e0$8fo@dub-news-svc-4.compuserve.com> Philippe Verdy
  19. <100105.3120@compuserve.com> writes:
  20.  
  21. |> Would not it be great if we could simply define such members
  22. |> as "unconst" like in the following example :
  23.  
  24. |>   class T {
  25. |>   public:
  26. |>     T()                   { ...; _mark = 0; }
  27. |>     virtual ~T();
  28.  
  29. |>     virtual void show() const;
  30. |>   protected:
  31. |>     void mark() const     { _mark = 1; } // RELAXED HERE
  32. |>     void unmark() const   { _mark = 0; } // RELAXED HERE
  33. |>     bool ismarked() const { return _mark; }
  34. |>   private:
  35. |>     unconst char _mark; // HERE IS WHERE THIS APPLIES
  36. |>   }
  37.  
  38. You can.  Except that `unconst' is spelled `mutable'.
  39. -- 
  40. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  41. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  42. Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
  43.                 -- A la recherche d'une activitΘ dans une region francophone
  44.  
  45.  
  46.  
  47. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  48. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  49. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  50. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  51. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  52.